import 'package:flutter/material.dart';

class SpacedItemsList extends StatelessWidget {
  const SpacedItemsList({super.key});

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(builder: (context, constraints) {
      return SingleChildScrollView(
        child: ConstrainedBox(
          constraints: BoxConstraints(
            minHeight: constraints.maxHeight,
          ),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children:
                List.generate(4, (index) => SpacedItem(text: 'Item $index')),
          ),
        ),
      );
    });
  }
}

class SpacedItem extends StatelessWidget {
  const SpacedItem({super.key, required this.text});

  final String text;

  @override
  Widget build(BuildContext context) => Card(
        child: SizedBox(
          height: 100,
          child: Center(child: Text(text)),
        ),
      );
}
